# -*- coding: utf-8 -*-

import pygtk
pygtk.require('2.0')
import gtk, os

class GladeWnd(gtk.Builder):
    def __init__(self, gladeSrcFile):
        super(GladeWnd, self).__init__()
        self.add_from_file(gladeSrcFile)

    def __getattr__(self, attr):
        # удобней писать self.window1, чем self.get_object('window1')
        obj = self.get_object(attr)
        if not obj:
            raise AttributeError('object %r has no attribute %r' % (self, attr))
        #setattr(self, attr, obj)
        return obj
    
    def fillListStr(self, widget, vals):
        model = gtk.ListStore(str)
        for val in vals:
            model.append([val])
        widget.set_model(model)
        cell = gtk.CellRendererText()
        widget.pack_start(cell, False)
        widget.add_attribute(cell, 'text', 0)
        widget.set_active(0)
